<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="{{ config.SITE_URL }}" class="brand-link" style="text-align:center;letter-spacing:5px">
        <span class="brand-text font-weight-bold">{{ config['SITE_NAME'] or 'DaoCMS' }}</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
        <!-- Sidebar user panel (optional) -->
        <div class="user-panel mt-3 pb-3 mb-3 d-flex">
            <div class="image">
                <img src="{{ url_for('admins.static', filename='lte/style/img/user2-160x160.jpg') }}"
                     class="img-circle elevation-2" alt="User Image">
            </div>
            <div class="info">
                <a href="{{ url_for('admins.me_info') }}" class="d-block">Admin</a>
            </div>
        </div>

        <!-- Sidebar Menu -->
        <nav class="mt-2" id="sidebar-menus">
            <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
                {%- for menus in config.ADMINS_MENUS -%}
                {%- if 'chindren' in menus.keys() -%}
                <li class="nav-item has-treeview{%- if menus.get('open') %} menu-open{%- endif -%}">
                    <a href="javascript:void(0);" class="nav-link">
                        <i class="nav-icon fas{% if menus['badge'] %} {{ menus['badge'] }}{% else %} fa-th{% endif %}"></i>
                        <p>{{ menus['title'] }}</p>
                        <i class="fas fa-angle-left right"></i>
                    </a>
                    <ul class="nav nav-treeview">
                        {%- for _menus in menus['chindren'] -%}
                        <li class="nav-item">
                            <a class="nav-link"
                               href="{%- if _menus['endpoint'] -%}{{ url_for(_menus['endpoint'], **_menus.get('param', {})) }}{%- endif -%}">
                                <i class="far fa-circle nav-icon"></i>
                                <p>{{ _menus['title'] }}</p>
                            </a>
                        </li>
                        {%- endfor -%}
                    </ul>
                </li>
                {%- else -%}
                <li class="nav-item">
                    <a class="nav-link"
                       href="{%- if menus['endpoint'] -%}{{ url_for(menus['endpoint'], **menus.get('param', {})) }}{%- endif -%}">
                        <i class="nav-icon fas{% if menus['badge'] %} {{ menus['badge'] }}{% else %} fa-th{% endif %}"></i>
                        <p>
                            {{ menus['title']|e }}
                        </p>
                    </a>
                </li>
                {%- endif -%}
                {%- endfor -%}
            </ul>
        </nav>
        <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
</aside>